#ifndef _TREE_
#define _TREE_
#include <string>
using namespace std;
struct TreeNode {
	int data;
	TreeNode* parent;
	TreeNode* left;
	TreeNode* right;
};
typedef TreeNode* TreeNodePtr;

class CBinTree {
private:
	TreeNodePtr root;
	void initializeNode(TreeNodePtr node, int key);
	void preOrderHelper(TreeNodePtr node);
	void inOrderHelper(TreeNodePtr node);
	void postOrderHelper(TreeNodePtr node);
	TreeNodePtr searchTreeHelper(TreeNodePtr node, int key);
	TreeNodePtr deleteNodeHelper(TreeNodePtr node, int key);
	void printHelper(TreeNodePtr root, string indent, bool last);
public:
	CBinTree();
	void createSampleTree1();
	void preorder();
	void inorder();
	void postorder();
	TreeNodePtr searchTree(int k);
	TreeNodePtr minimum(TreeNodePtr node);
	TreeNodePtr maximum(TreeNodePtr node);
	TreeNodePtr successor(TreeNodePtr x);
	TreeNodePtr predecessor(TreeNodePtr x);
	void insert(int key);
	TreeNodePtr getRoot();
	TreeNodePtr deleteNode(int data);
	void prettyPrint();

};
#endif